package com.zhuangjie.shop.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 店铺经营类型枚举 1只店食、2只配送  3店食与配送)
 * @author zhuangjie
 * @date 2023/09/27
 */
@Getter
@AllArgsConstructor
public enum BusinessTypeEnum {

    /**
     * 配送
     */
    DELIVERY("1", "配送"),
    /**
     * 店食
     */
    SHOP_EAT("2", "店食"),
    /**
     * 自提
     */
    SELF_PICKUP("3", "自提");

    private final String value;
    private final String name;

    public static final String ALL = "123";


    /**
     * 根据值获取名称
     *
     * @param value 值
     * @return 名称
     */
    public static String nameOf(String value) {
        for (BusinessTypeEnum businessTypeEnum : values()) {
            if (businessTypeEnum.value.equals(value)) {
                return businessTypeEnum.name;
            }
        }
        return "";
    }
}
